﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace LYR_RPA.utils
{
    static class HttpClientUtils
    {
        private static readonly HttpClient client = new HttpClient();
        public static async Task<string> PostRequextAsync(string url, Dictionary<string,string> dictionary)
        {
            url = "http://192.168.3.243:48080/system/auth/login"; // 替换为您要发送 POST 请求的 URL

            // 构造要发送的数据，这里假设是 JSON 格式的数据
            string jsonData = "{\"username\": \"admin\",\"password\": \"admin123\"}";

            // 构造 HTTP 请求内容
            HttpContent content = new StringContent(jsonData, Encoding.UTF8, "application/json");
            HttpResponseMessage response = await client.PostAsync(url, content);
            Console.WriteLine(response.Content);
            return response.Content.ToString();
        }
        public static async Task<string> GetRequextAsync(string url)
        {

            var response = await client.GetAsync(url);
           
            Console.WriteLine(response.Content);
            return "";
        }
    }
}
